package com.door.erp.dao.base;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.orm.hibernate3.HibernateTemplate;

/**
 * Dao层通用方法
 * @author yangxuelin
 */
public interface GenericDao<T, PK extends Serializable> {
	
	public void add(T object);
	
	public void addOrUpdate(T object);
	
	public void delete(T object);
	
	public void delete(PK id);
	
	public void modify(T object);
	
	public T get(PK id);
	
	public List<T> getAll();
	
	public List<T> getAll(final int startRow, final int pageSize);
	
	//获取所有记录(旧方法)
	public List<T> getAll(final String hql);
	
	//根据条件获取列表(旧方法)
	public List<T> getAll(final String hql, Object... values);
	
	//分页获取列表(旧方法)
	public List<T> getAll(final String hql, Object[] params, final int startRow, final int pageSize);
	
	//获取记录数(旧方法)
	public int getCount(final String hql, Object... params);

	//根据条件获取列表
	public List<T> getAll(final Map<String, Object> params);
	
	//分页获取列表
	public List<T> getAll(final Map<String, Object> params, final int startRow,  final int pageSize);
	
	public int getCount();
	//获取记录数
	public int getCount(final Map<String, Object> params);
	
	//批量执行
	public Integer executeUpdateByQuery(final String sql, Object[] params);
	
	public void flush();
	
	public HibernateTemplate getHibernateTemplate();

}
